<style>
.CodeMirror{height:100%;font-size:14px;}
</style>
<script>
function refreshCmsTemplate(){
	$('textarea[name=content]',navTab.getCurrentPanel()).val(cmsTemplateEditor.getValue());
}
</script>
<h2 class="contentTitle">
	<a href="cmsTemplate/placeLookup.html" target="dialog" mask="true">推荐位</a>
 	<a href="cmsTemplate/ftlLookup.html" target="dialog" mask="true">模板片段</a>
<#if !path?has_content||!path?starts_with('/ftl/')>
	<a href="cmsTemplate/metadata.html?path=${'/ftl/'?url}" target="navTab" rel="cmsTemplate/metadata">创建模板片段</a>
</#if>
	<a href="cmsTemplate/delete.do?path=${path?html?url}&navTabId=cmsTemplate/list" title="确定要删除该模板吗?" target="ajaxTodo">删除模板</a>
 </h2>
<div class="pageContent">
	<form method="post" action="cmsTemplate/save.do?navTabId=cmsTemplate/list" class="pageForm required-validate" onsubmit="refreshCmsTemplate();return validateCallback(this, navTabAjaxDone);">
		<div class="pageFormContent" layoutH="98" style="background:#ffffff;">
	   		<div>
				<input name="path" type="hidden" value="${path?html}"/>
				<textarea name="content" id="cmsTemplateEditor"><@_templateContent path=path>${(object?html)!}</@_templateContent></textarea>
				<script>
					var cmsTemplateEditor = CodeMirror.fromTextArea(document.getElementById('cmsTemplateEditor'), {
				        mode: "freemarkermixed",
				        lineNumbers: true,
				        tabSize        : 4,
				        indentUnit     : 4,
				        lineWrapping   : true,
				        indentWithTabs : true,
				        extraKeys: { "Ctrl-Space": "autocomplete" }
					});
				</script>
			</div>
		</div>
		<div class="formBar">
			<ul>
				<@_metadata path=path><#assign a=object/></@_metadata>
				<li><a class="button" href="cmsTemplate/metadata.html?path=${(path?url)!}" target="navTab" rel="cmsTemplate/metadata"><span>${(a.alias)!(path?html)!}模板元数据</span></a></li>
				<li><a class="button" href="cmsTemplate/placeList.html?path=${(path?url)!}" target="navTab" rel="cmsTemplate/placeList"><span>${(a.alias)!(path?html)!}推荐位管理</span></a></li>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
</div>